import * as React from 'react';
import * as ReactDOM from 'react-dom';
import history from "./history";

import registerServiceWorker from './registerServiceWorker';
import { Provider } from 'react-redux';
import { Router } from 'react-router-dom';
import Route from "./route";

import { ConfigProvider} from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
import 'antd/dist/antd.css';
import "./assets/css/reset.scss";
// 引入编辑器样式
import 'braft-editor/dist/index.css';


import store from 'src/stores/index';
import API from  'src/config/api'
import * as userType from "src/stores/userinfo/action-type"

API.getUserInfo({_quite:1}).then((res:any)=>{
  console.log(res);
  store.dispatch({
    type:userType.SETUSERINFO,
    value:res
  })
}).catch((e:any)=>{
  console.log(e);
});

ReactDOM.render(
    <ConfigProvider locale={zhCN}>
      <Provider store = { store }>
        <Router history={history}>
          <Route />
        </Router>
      </Provider>
     
    </ConfigProvider>
  , 
  document.getElementById('root') as HTMLElement
);
registerServiceWorker();
